home *** CD-ROM | disk | FTP | other *** search
/ Webster's Millennium Amer…Sign Language Dictionary / ASL.ISO / mac / SHARED.cst / 00006_Script_download tools < prev    next >
Text File  |  2001-09-17  |  11KB  |  330 lines

  1. --∂ï
  2. on addDownLoads
  3.   global gWordList,gAddList,gDownLoads,gDLToOtherLangs,gStartUpVol
  4.   if the runmode = "author" then
  5.     put "addDownLoads"
  6.   end if
  7.   scanForNewDownLoads
  8.   set gDownLoadsNotFound = []
  9.   tell window "dData" to put integer(field "TotalDown") into gNumDownLoads
  10.   if gNumDownLoads = 0 then exit
  11.   tell window "dData" to put the text of cast "downloads" into gDownLoads
  12.   if gDownLoads = "none" then exit
  13.   set DLTemp = getStringToList(gDownLoads)
  14.   sort(DLTemp)
  15.   set gDownLoads=getListToString(DLTemp)
  16.   delete line (the number of lines of gDownLoads) of gDownLoads
  17.   repeat with i = 1 to the number of lines of gDownLoads
  18.     add gWordList,line i of gDownLoads
  19.   end repeat
  20.   if getAt(gWordList,count(gWordList)) = "" then deleteAt(gWordList,count(gWordList))
  21.   sort(gWordList)
  22.   set gAddList = []
  23.   repeat with i = 1 to the number of lines of gDownLoads
  24.     add gAddList getPos(gWordList,line i of gDownLoads)
  25.   end repeat
  26.   updateAlphaLocs
  27.   updateListing
  28. end 
  29.  
  30. on scanForNewDownLoads
  31.   global gStartUpVol,myAlertWindow
  32.   set n = 1
  33.   if the machineType = 256 then
  34.     if getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n) = "" then exit
  35.     --peteMACK 07.09.01  alertBox "Adding Downloaded signs..."
  36.     repeat while getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n) <> ""
  37.       set aFile = getNthFileNameInFolder(gStartUpVol&"\dwnlds\TEXT", n)
  38.       if aFile contains ".txt" then addDownLoad aFile
  39.       set n=n+1
  40.     end repeat
  41.     --peteMACK 07.09.01  close myAlertWindow
  42.     --peteMACK 07.09.01  forget myAlertWindow
  43.   else
  44.     if getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n) = "" then exit
  45.     --peteMACK 07.09.01  alertBox "Adding Downloaded signs..."
  46.     repeat while getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n) <> "" 
  47.       set aFile = getNthFileNameInFolder(gStartUpVol&":dwnlds:TEXT", n)
  48.       if aFile contains ".txt" then addDownLoad aFile
  49.       set n=n+1
  50.     end repeat
  51.     --peteMACK 07.09.01  close myAlertWindow
  52.     --peteMACK 07.09.01  forget myAlertWindow
  53.   end if
  54. end
  55.  
  56. on GetString theFile, vAppName, theString
  57.   global myFileObject
  58.   if objectP(myFileObject) then set myFileObject = 0
  59.   set myFileObject = new(xtra "fileIO")
  60.   openFile(myFileObject,theFile,1)
  61.   set vFileData = readFile(myFileObject)
  62.   closeFile(myFileObject)
  63.   set myFileObject = 0
  64.   if voidP(vFileData) then return the pathname
  65.   put the number of lines in vFileData into vNumOfLines
  66.   repeat with x = 1 to vNumOfLines
  67.     set vLine = line x of vFileData
  68.     if vLine contains theString then
  69.       set the itemdelimiter = "="
  70.       return item 2 of vLine
  71.       set the itemdelimiter = ","
  72.       exit
  73.     end if
  74.   end repeat
  75.   if voidP(theString) then return vFileData
  76. end
  77.  
  78. on ReadCDTestFileFail theFile
  79.   global myFileObject
  80.   if objectP(myFileObject) then set myFileObject = 0
  81.   set vFileToRead  = theFile
  82.   set myFileObject = new(xtra "fileIO")
  83.   openFile(myFileObject,vFileToRead,1)
  84.   set vFileData    = readFile(myFileObject)
  85.   set vFlag        = status(myFileObject) 
  86.   closeFile(myFileObject)
  87.   set myFileObject = 0
  88.   if the runmode = "author" then
  89.     put "vFileData" && vFileData
  90.   end if
  91.   return vFileData
  92. end
  93.  
  94. on addDownLoad aFile
  95.   global gStartUpVol
  96.   if the runmode = "author" then
  97.     put "addDownLoad" && aFile
  98.   end if
  99.   ----PETEMACK 06.27.01
  100.   --  if the machineType = 256 then
  101.   --    set openFile = fileio(mNew,"read",gStartUpVol&"\dwnlds\TEXT\"&aFile)
  102.   --  else set openFile = fileio(mNew,"read",gStartUpVol&":dwnlds:TEXT:"&aFile)
  103.   --  set dictEntry = openFile(mReadFile)
  104.   
  105.   if the machineType = 256 then
  106.     set dictEntry = ReadCDTestFileFail (gStartUpVol&"\dwnlds\TEXT\"&aFile)
  107.   else
  108.     set dictEntry = ReadCDTestFileFail (gStartUpVol&":dwnlds:TEXT:"&aFile)
  109.   end if
  110.   
  111.   --  set aFile = "Read Me First"
  112.   --  set vFilePath = string(gStartUpVol&":dwnlds:TEXT:"&aFile)
  113.   --  GetString vFilePath
  114.   --  set dictEntry = the result
  115.   
  116.   set the itemDelimiter to TAB
  117.   tell window "dData" to set EntryExists = the number of cast (item 1 of dictEntry)
  118.   alertMessage "Adding Downloaded signs..."&return&"- "&item 1 of dictEntry&" -"
  119.   if EntryExists = -1 then
  120.     tell window "dData" to set newCast = findEmpty(cast 5000)
  121.     tell window "dData" to duplicate cast 5000,newCast 
  122.     --
  123.     tell window "dData" to set the name of cast newCast = item 1 of dictEntry
  124.     tell window "dData" to put "" into field newCast
  125.     repeat with i = 2 to the number of items of dictEntry
  126.       tell window "dData" to put item i of dictEntry&"*" after field newCast
  127.     end repeat
  128.     tell window "dData" to put string(integer(field "totalDown")+1) into field "totalDown"
  129.     tell window "dData" to put field "downloads" into gDownLoads
  130.     if gDownLoads = "none" then
  131.       tell window "dData" to put the name of cast newCast into field "DownLoads"
  132.     else tell window "dData" to put return&the name of cast newCast after field "DownLoads"
  133.   end if
  134.   set the itemDelimiter to ","
  135.   ----PETEMACK 06.27.01   openFile(mDispose)
  136. end
  137.  
  138. on fileFound aWord
  139.   global gStartUpVol,gDownLoads
  140.   tell window "dData" to put field aWord into entryData
  141.   set the itemdelimiter to "*"
  142.   set fileName = item 5 of entryData
  143.   set the itemdelimiter to ","
  144.   repeat with i = 1 to the number of lines of gDownLoads
  145.     
  146.     if the machineType = 256 then
  147.       if getNthFileNameInFolder(gStartUpVol&"\dwnlds", i) = fileName then
  148.         return true
  149.       end if
  150.     else
  151.       if getNthFileNameInFolder(gStartUpVol&":aslFiles:dwnlds", i) = fileName then
  152.         return true
  153.       end if
  154.     end if
  155.     
  156.   end repeat
  157.   return false
  158. end 
  159.  
  160. on DownLoadList
  161.   --tell window "dData" to put the text of cast "downloads"
  162. end DownLoadList
  163.  
  164. on updateAlphaLocs
  165.   global gAlphaBet,AlphaLocsE,gDownLoads
  166.   repeat with i = 1 to the number of lines of gDownLoads
  167.     set letter = checkCase(char 1 of line i of gDownLoads)
  168.     repeat with j = getPos(gAlphaBet,letter)+1 to 25
  169.       set update = integer(getat(AlphaLocsE,getPos(gAlphaBet,letter)+1))+1
  170.       setAt(AlphaLocsE,getPos(gAlphaBet,letter)+1,string(update))
  171.       set letter = NumtoChar(chartonum(letter)+1)
  172.     end repeat
  173.   end repeat
  174. end
  175.  
  176. on updateListing
  177.   global scrollListE,gDownLoads,gWordList
  178.   repeat with i = 1 to the number of lines of gDownLoads
  179.     set insertPos = (getPos(gWordlist,line i of gDownLoads)-1)
  180.     put return&line i of gDownLoads after line insertPos of scrollListE
  181.   end repeat
  182. end
  183.  
  184. on checkCase letter
  185.   if charToNum(letter) > 96 then return numToChar(charToNum(letter)-(96-64))
  186.   else return letter
  187. end checkCase
  188.  
  189. on addDLToSpanish
  190.   global gAddList,gDownLoads,gWordList
  191.   global gSpList,gSpSortedList,gSpAddedList
  192.   if voidp(gAddList) or gAddList = [] then exit
  193.   set the itemdelimiter to "*"
  194.   set gSpAddedList = []
  195.   repeat with i = 1 to count(gAddList)
  196.     if getAt(gAddList,i) = 0 then next repeat
  197.     tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
  198.     
  199.     set position = getAt(gAddList,i)
  200.     
  201.     set aWord = item 1 of entryData
  202.     if getPos(gSpList,aWord) = 0 then
  203.       addAt gSpList, position, aWord
  204.       addAt gSpSortedList, position, aWord
  205.       add gSpAddedList,aWord
  206.     end if
  207.   end repeat
  208.   updateSpanishAlphaLocs
  209.   set the itemDelimiter to ","
  210. end
  211.  
  212. on addDLToFrench
  213.   global gAddList,gDownLoads,gWordList
  214.   global gFrList,gFrSortedList,gFrAddedList
  215.   if voidp(gAddList) or gAddList = [] then exit
  216.   set the itemdelimiter to "*"
  217.   set gFrAddedList = []
  218.   repeat with i = 1 to count(gAddList)
  219.     if getAt(gAddList,i) = 0 then next repeat
  220.     tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
  221.     
  222.     set position = getAt(gAddList,i)
  223.     
  224.     set aWord = item 2 of entryData
  225.     if getPos(gFrList,aWord) = 0 then
  226.       addAt gFrList, position, aWord
  227.       addAt gFrSortedList, position, aWord
  228.       add gFrAddedList,aWord
  229.     end if
  230.   end repeat
  231.   updateFrenchAlphaLocs
  232.   set the itemDelimiter to ","
  233. end
  234.  
  235. on addDLToGerman
  236.   global gAddList,gDownLoads,gWordList
  237.   global gGeList,gGeSortedList,gGeAddedList
  238.   if voidp(gAddList) or gAddList = [] then exit
  239.   set the itemdelimiter to "*"
  240.   set gGeAddedList = []
  241.   repeat with i = 1 to count(gAddList)
  242.     if getAt(gAddList,i) = 0 then next repeat
  243.     tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
  244.     
  245.     set position = getAt(gAddList,i)
  246.     
  247.     set aWord = item 3 of entryData
  248.     if getPos(gGeList,aWord) = 0 then
  249.       addAt gGeList, position, aWord
  250.       addAt gGeSortedList, position, aWord
  251.       add gGeAddedList,aWord
  252.     end if
  253.   end repeat
  254.   updateGermanAlphaLocs
  255.   set the itemDelimiter to ","
  256. end
  257.  
  258. on addDLToItalian
  259.   global gAddList,gDownLoads,gWordList
  260.   global gItList,gItSortedList,gItAddedList
  261.   if voidp(gAddList) or gAddList = [] then exit
  262.   set the itemdelimiter to "*"
  263.   set gItAddedList = []
  264.   repeat with i = 1 to count(gAddList)
  265.     if getAt(gAddList,i) = 0 then next repeat
  266.     tell window "dData" to set entryData = the text of cast getAt(gWordList,getAt(gAddList,i))
  267.     
  268.     set position = getAt(gAddList,i)
  269.     
  270.     set aWord = item 4 of entryData
  271.     if getPos(gItList,aWord) = 0 then
  272.       addAt gItList, position, aWord
  273.       addAt gItSortedList, position, aWord
  274.       add gItAddedList,aWord
  275.     end if
  276.   end repeat
  277.   updateItalianAlphaLocs
  278.   set the itemDelimiter to ","
  279. end
  280.  
  281. on updateSpanishAlphaLocs
  282.   global gAlphaBet,gSpAlpha,gSpAddedList
  283.   repeat with i = 1 to count(gSpAddedList)
  284.     set letter = checkCase(char 1 of getAt(gSpAddedList,i))   
  285.     repeat with j = getPos(gAlphaBet,letter)+1 to 25
  286.       set update = integer(getat(gSpAlpha,getPos(gAlphaBet,letter)+1))+1
  287.       setAt(gSpAlpha,getPos(gAlphaBet,letter)+1,string(update))
  288.       set letter = NumtoChar(chartonum(letter)+1)
  289.     end repeat
  290.   end repeat
  291. end
  292.  
  293. on updateFrenchAlphaLocs
  294.   global gAlphaBet,gFrAlpha,gFrAddedList
  295.   repeat with i = 1 to count(gFrAddedList)
  296.     set letter = checkCase(char 1 of getAt(gFrAddedList,i))
  297.     repeat with j = getPos(gAlphaBet,letter)+1 to 25
  298.       set update = integer(getat(gFrAlpha,getPos(gAlphaBet,letter)+1))+1
  299.       --      setAt(gFrAlpha,getAt(gAlphaBet,letter),string(update))
  300.       
  301.       setAt(gFrAlpha,getPos(gAlphaBet,letter),string(update))
  302.       
  303.       set letter = NumtoChar(chartonum(letter)+1)
  304.     end repeat
  305.   end repeat
  306. end
  307.  
  308. on updateGermanAlphaLocs
  309.   global gAlphaBet,gGeAlpha,gGeAddedList
  310.   repeat with i = 1 to count(gGeAddedList) 
  311.     set letter = checkCase(char 1 of getAt(gGeAddedList,i))
  312.     repeat with j = getPos(gAlphaBet,letter)+1 to 25
  313.       set update = integer(getat(gGeAlpha,getPos(gAlphaBet,letter)+1))+1
  314.       setAt(gGeAlpha,getPos(gAlphaBet,letter)+1,string(update))
  315.       set letter = NumtoChar(chartonum(letter)+1)
  316.     end repeat
  317.   end repeat
  318. end
  319.  
  320. on updateItalianAlphaLocs
  321.   global gAlphaBet,gItAlpha,gItAddedList
  322.   repeat with i = 1 to count(gItAddedList)
  323.     set letter = checkCase(char 1 of getAt(gItAddedList,i))
  324.     repeat with j = getPos(gAlphaBet,letter)+1 to 25
  325.       set update = integer(getat(gItAlpha,getPos(gAlphaBet,letter)+1))+1
  326.       setAt(gItAlpha,getPos(gAlphaBet,letter)+1,string(update))
  327.       set letter = NumtoChar(chartonum(letter)+1)
  328.     end repeat
  329.   end repeat
  330. end